[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
GOTO LABEL
Function
Transfer program control to LABEL (GO TO is a synonym).
Syntax
GOTO label
label - The label to which control should be transferred.
Remarks
GOTO is an essential part of just about every programming language, and
it is also an overused part of every one of those languages. When you
need to make a decision and alter program flow based on some condition
it is a necessary evil. For example, it is very useful in getting out of
deeply nested loops when a critical error of some sort occurs. For the
most part, avoid it if at all possible. Look for other options to write
your program, such as block IF, WHILE, and FOR statements. They are much
easier to understand and maintain than code with GOTO statements sprinkled
liberally throughout.
Examples
INTEGER i
STRING s
FOPEN 1,"FILE.DAT",O_RD,S_DW
WHILE (UPPER(s) <> "QUIT") DO
FGET 1,s
IF (FERR(1)) THEN
PRINTLN "Error, aborting..."
GOTO exit
ENDIF
INC i
PRINTLN "Line ",i,": ",s
ENDWHILE
:exit
FCLOSE 1
See Also:
GOSUB
RETURN
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson